﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true"
    CodeFile="DinhMucVatLieu.aspx.cs" Inherits="DinhMucVatLieu" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <div class="panel panel-success margin">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        Quản lý định mức vật liệu</h3>
                </div>
                <div class="panel-body">
                    <table width="100%">
                        <tr>
                            <td width="20%">
                                <span style="margin-left: 5px;">Mác</span><br />
                                <asp:DropDownList runat="server" CssClass="form-control width98" ID="dlMac" DataValueField="IDs"
                                    DataTextField="TenMacBeTong">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="dlMac" ErrorMessage="Chọn mác" Display="None" Text="*"></asp:RequiredFieldValidator>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Loại đá</span><br />
                                <asp:DropDownList runat="server" CssClass="form-control with98" ID="dlLoaiDa">
                                    <asp:ListItem Text="--Chọn loại đá--" Value=""></asp:ListItem>
                                    <asp:ListItem Text="Đá 1*2" Value="1"></asp:ListItem>
                                    <asp:ListItem Text="Đá 2*4" Value="2"></asp:ListItem>
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="dlLoaiDa" ErrorMessage="Chọn loại đá" Display="None" Text="*"></asp:RequiredFieldValidator>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Phụ gia</span><br />
                                <asp:DropDownList runat="server" CssClass="form-control width98" ID="dlPhuGia" DataValueField="IDs"
                                    DataTextField="TenLoaiVL">
                                </asp:DropDownList>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Từ ngày</span><br />
                                <asp:TextBox ID="txtTuNgay" runat="server" placeholder="Từ ngày" Visible="true" 
                                    CssClass="form-control with98"></asp:TextBox>
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtTuNgay"
                                    Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender9" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtTuNgay" ValidChars="/-" />
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator3" runat="server"
                                    ControlToValidate="txtTuNgay" ErrorMessage="Nhập ngày bắt đầu" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                            </td>
                            <td width="18%">
                                <span style="margin-left: 5px;">Đến ngày</span><br />
                                <%--<asp:DropDownList runat="server" CssClass="form-control width98" ID="dlNam">
                                </asp:DropDownList>--%>
                                <asp:TextBox ID="txtDenNgay" runat="server" placeholder="Đến ngày" Visible="true"
                                     CssClass="form-control with98"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator4" runat="server"
                                    ControlToValidate="txtDenNgay" ErrorMessage="Nhập ngày kết thúc" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                                <cc1:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtDenNgay"
                                    Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender10" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtDenNgay" ValidChars="/-" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%">
                                <span style="margin-left: 5px;">ĐM xi măng</span><br />
                                <asp:TextBox ID="txtDMXM" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtDMXM" ValidChars="." />
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">ĐM cát</span><br />
                                <asp:TextBox ID="txtDMCat" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender6" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtDMCat" ValidChars="." />
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">ĐM đá</span><br />
                                <asp:TextBox ID="txtDMDa" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender7" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtDMDa" ValidChars="." />
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">ĐM nước</span><br />
                                <asp:TextBox ID="txtDMNuoc" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtDMNuoc" ValidChars="." />
                            </td>
                            <td>
                                <span style="margin-left: 5px;">ĐM phụ gia</span><br />
                                <asp:TextBox ID="txtDMPhuGia" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtDMPhuGia" ValidChars="." />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:Button ID="btnSave" ValidationGroup="Them" runat="server" Style="margin-left: 5px;"
                                    Text="Lưu lại" CssClass="btn btn-primary" OnClick="btnSave_Click" />
                                <asp:Button ID="btncapnhat" runat="server" Text="Cập nhật" CssClass="btn btn-info"
                                    OnClick="btncapnhat_Click" Visible="false" />
                                <asp:Button ID="btnCancel" runat="server" Text="Nhập mới" CssClass="btn btn-warning"
                                    OnClick="btnCancel_Click" />

                                    
                            </td>
                            <td colspan="3">
                                <asp:TextBox ID="txtGhiChu" placeholder="Ghi chú" runat="server" CssClass="form-control withall"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                    <asp:HiddenField ID="hdTuNgay" runat="server" />
                    <asp:HiddenField ID="hdDenNgay" runat="server" />
                    <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Bạn phải nhập các trường sau:"
                        ShowMessageBox="true" ValidationGroup="Them" ShowSummary="false" EnableClientScript="true"
                        runat="server" />
                </div>
            </div>
            <div style="margin: 5px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <b>Bảng định mức vật liệu</b>
                        <asp:DropDownList ID="dlThang" AutoPostBack="true" runat="server" Width="150px" CssClass="form-control"
                            OnSelectedIndexChanged="dlThang_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:DropDownList ID="dlNam" AutoPostBack="true" OnSelectedIndexChanged="dlThang_SelectedIndexChanged"
                            runat="server" Width="110px" CssClass="form-control">
                        </asp:DropDownList>
                        <asp:DropDownList ID="dlMacLoc" ToolTip="Chọn mác" runat="server"
                            DataValueField="IDs" Width="180px" CssClass="form-control" 
                            DataTextField="TenMacBeTong">
                        </asp:DropDownList>
                        <asp:DropDownList ID="dlLoaiDaLoc" ToolTip="Chọn loại đá" runat="server" Width="140px" CssClass="form-control" DataTextField="LoaiDa" DataValueField="IDs">
                        <asp:ListItem Text="--Chọn loại đá--" Value="0"></asp:ListItem>
                        <asp:ListItem Text="Đá 1*2" Value="1"></asp:ListItem>
                        <asp:ListItem Text="Đá 2*4" Value="2"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:Button ID="btnSearch" CssClass="btn btn-warning" runat="server" Text="Tìm kiếm"
                            OnClick="btnSearch_Click" />
                        </div>
                    <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GV" runat="server" AutoGenerateColumns="false" BackColor="White"
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall"
                            Width="99%" OnRowCommand="GV_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/img/delete-24.png"
                                            OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("IDs")%>'
                                            Text="Xóa" CommandName="Del" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Sửa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbSua" runat="server" Width="15px" Height="15px" ImageUrl="~/img/edit.ico"
                                            CommandArgument='<%#Eval("IDs")%>' Text="Sửa" CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="TenPhuGia" ItemStyle-CssClass="padding" HeaderText="Phụ gia"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <asp:BoundField DataField="TenMac" ItemStyle-CssClass="padding" HeaderText="Mác"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="TenLoaiDa" ItemStyle-CssClass="padding" HeaderText="Loại đá"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                
                                <asp:BoundField DataField="DMXM" ItemStyle-CssClass="padding" HeaderText="ĐM xi măng"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="DMCat" ItemStyle-CssClass="padding" HeaderText="ĐM cát"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="DMDa" ItemStyle-CssClass="padding" HeaderText="ĐM đá"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="DMNuoc" ItemStyle-CssClass="padding" HeaderText="ĐM nước"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="DMPhuGia" ItemStyle-CssClass="padding" HeaderText="ĐM phụ gia"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                <asp:BoundField DataField="NgayBD" ItemStyle-CssClass="padding" HeaderText="Từ ngày"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="NgayKT" ItemStyle-CssClass="padding" HeaderText="Đến ngày"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" />
                                    <asp:BoundField DataField="GhiChu" ItemStyle-CssClass="padding" HeaderText="Ghi chú"
                                    HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                        <div style="margin: 5px;">
                            <asp:Button ID="btnFirst" runat="server" Text="Đầu" CssClass="btn btn-primary" OnClick="btnFirst_Click" />
                            <asp:Button ID="btnPre" runat="server" Style="margin-left: 5px;" Text="Trước" CssClass="btn btn-primary"
                                OnClick="btnPre_Click" />
                            <asp:Button ID="btnNext" runat="server" Style="margin-left: 5px;" Text="Sau" CssClass="btn btn-warning"
                                OnClick="btnNext_Click" />
                        </div>
                    </div>
                </div>
                <asp:HiddenField ID="hdID" runat="server" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
